﻿{%extends "admin/base.html"%}
{% load i18n %}

{%block content%}
<div class="wrap">
	<h2 class="title1">{% trans "Modify user information" %}</h2>
	{% if messages %}
	<ul class="messages">
		{% for message in messages %}
		<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
		{% endfor %}
	</ul>
	{% endif %}
	<form method="post" action="{{ user.get_profile.get_admin_save_profile_url }}" enctype="multipart/form-data">
		<div class="dashboard-window" style="width: 60%;">
			<h3>{% trans "Who are you" %}</h3>
			<div class="inside">
				<table class="form-table2">
					<tbody>
						<tr>
							<th>{{ userform.username.label_tag }}</th>
							<td class="readonly">{{ userform.username }}
								<span class="help_text">{{ userform.username.help_text }}</span></td>
							<td class="error-col"></td>
						</tr>
						<tr>
							<th>{{ userform.first_name.label_tag }}</th>
							<td {% if userform.first_name.errors %}class="error"{% endif %}>{{ userform.first_name }}</td>
							<td>{% if userform.first_name.errors %}{{ userform.first_name.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ userform.last_name.label_tag }}</th>
							<td {% if userform.last_name.errors %}class="error"{% endif %}>{{ userform.last_name }}</td>
							<td>{% if userform.last_name.errors %}{{ userform.last_name.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.nickname.label_tag }}</th>
							<td {% if profileform.nickname.errors %}class="error"{% endif %}>{{ profileform.nickname }}</td>
							<td>{% if profileform.nickname.errors %}{{ profileform.nickname.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.gender.label_tag }}</th>
							<td {% if profileform.gender.errors %}class="error"{% endif %}>{{ profileform.gender }}</td>
							<td>{% if profileform.gender.errors %}{{ profileform.gender.errors }}{% endif %}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<div class="dashboard-window" style="width: 60%;">
			<h3>{% trans "Hou to find you" %}</h3>
			<div class="inside">
				<table class="form-table2">
					<tbody>
						<tr>
							<th>{{ userform.email.label_tag }}<span class="red">*</span></th>
							<td {% if userform.email.errors %}class="error"{% endif %}>{{ userform.email }}</td>
							<td class="error-col">{% if userform.email.errors %}{{ userform.email.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.telephone.label_tag }}</th>
							<td {% if profileform.telephone.errors %}class="error"{% endif %}>
								{{ profileform.telephone }}</td>
							<td>{% if profileform.telephone.errors %}{{ profileform.telephone.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.qq.label_tag }}</th>
							<td {% if profileform.qq.errors %}class="error"{% endif %}>
								{{ profileform.qq }}</td>
							<td>{% if profileform.qq.errors %}{{ profileform.qq.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.msn.label_tag }}</th>
							<td {% if profileform.msn.errors %}class="error"{% endif %}>
								{{ profileform.msn }}</td>
							<td>{% if profileform.msn.errors %}{{ profileform.msn.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.birthday.label_tag }}</th>
							<td {% if profileform.birthday.errors %}class="error"{% endif %}>
								{{ profileform.birthday }}</td>
							<td>{% if profileform.birthday.errors %}{{ profileform.birthday.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.birth_town.label_tag }}</th>
							<td {% if profileform.birth_town.errors %}class="error"{% endif %}>
								{{ profileform.birth_town }}</td>
							<td>{% if profileform.birth_town.errors %}{{ profileform.birth_town.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.live_town.label_tag }}</th>
							<td {% if profileform.live_town.errors %}class="error"{% endif %}>
								{{ profileform.live_town }}</td>
							<td>{% if profileform.live_town.errors %}{{ profileform.live_town.errors }}{% endif %}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<div class="dashboard-window" style="width: 60%;">
			<h3>{% trans "About you" %}</h3>
			<div class="inside">
				<table class="form-table2">
					<tbody>
						<tr>
							<th>{{ profileform.image_url.label_tag }}</th>
							<td {% if profileform.image_url.errors %}class="error"{% endif %} valign="middle">
								<img src="{% if user.get_profile.image_url %}/site_media/{{ user.get_profile.image_url }}{% else %}/static/images/default_user_picture.png{% endif %}" 
									width="60px" height="60px" style="float: left;">
								{{ profileform.image_url }}</td>
							<td class="error-col">{% if profileform.image_url.errors %}{{ profileform.image_url.errors }}{% endif %}</td>
						</tr>
						<tr>
							<th>{{ profileform.description.label_tag }}</th>
							<td {% if profileform.description.errors %}class="error"{% endif %} colspan="2">
								{{ profileform.description }}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<p class="submit">
			<input type="hidden" value="{{ user.id }}" id="user" name="user">
			<input type="submit" name="submit" value="{% trans 'Save settings' %}" class="button-primary">
		</p>
	</form>
	
</div>
{%endblock%}